/*
 * Copyright (c) 2020 hebeiyiliuba.com
 * All rights reserved.
 *
 */
package org.jeecg.common.constant.enums;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

/**
 * 运单类型
 *
 * @author duanlikao
 * @created 2020/12/14
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum ShippingTyeEnum {

    SHIPPING_TYE_1("1", "单价"),
    SHIPPING_TYE_2("2", "议价"),
    SHIPPING_TYE_3("3", "竞价"),
    SHIPPING_TYE_4("4", "包车价"),
    ;

    private String code;
    private String msg;

    private static Map<Integer, ShippingTyeEnum> codeMap = Maps.newHashMap();

    public String getCode() {
        return this.code;
    }

    public String getDesc() {
        return this.msg;
    }

    public static String getMsg(String code) {
        return codeMap.containsKey(code) ? codeMap.get(code).getDesc() : StringUtils.EMPTY;
    }

    public static boolean isValid(String code) {
        return codeMap.containsKey(code);
    }


    public static ShippingTyeEnum getReportPlatformEnumByVal(String code) {
        return codeMap.get(code);
    }

}
